using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableCopyBoxDao:DaoBase<TableCopyBox>
    {
        public override void AddPrimaryIndex(TableCopyBox model)
        {
            cachePrimary[model.BoxId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableCopyBox.txt";
        }

        protected override TableCopyBox ParseRowData(string[] rowData)
        {
            TableCopyBox data = new TableCopyBox();
			data.BoxId = rowData [0];
			data.MissionId = rowData [1];

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.BoxX = 0;
            }
            else
            {
                data.BoxX = double.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.BoxY = 0;
            }
            else
            {
                data.BoxY = double.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.BoxZ = 0;
            }
            else
            {
                data.BoxZ = double.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.BoxAngle = 0;
            }
            else
            {
                data.BoxAngle = double.Parse(rowData[5]);
            }
			data.DropAward = rowData [6];
			data.BoxEffect0 = rowData [7];
			data.BoxEffect1 = rowData [8];
			data.BoxRes = rowData [9];

            return data;
        }


        public override void AddOneIndex(TableCopyBox model)
        {
            if (!cacheOneIndex.ContainsKey(model.MissionId.ToString()))
            {
                cacheOneIndex[model.MissionId.ToString()] = new List<TableCopyBox>();
            }
            cacheOneIndex[model.MissionId.ToString()].Add(model);
        }
    

    }

}
